<script setup lang="ts">
// import ScreenError from '@/views/topic/ScreenError.vue'
import ScreenCommon from '@/views/topic/ScreenCommon.vue'
// import ScreenHavedone from '@/views/topic/ScreenHavedone.vue'
import { onMounted, ref, shallowRef } from 'vue'
import { getSelfScreeningResult } from '@/api/wechat/screen_result'

const props = defineProps(['checkId'])
const id = props.checkId

const component = shallowRef(null)

const getCheckPersonInfo = (id) => {
  // todo 后端还没写  getSelfScreeningResult 需要改
  getSelfScreeningResult(id).then((res) => {
    if (!res.data) {
      component.value = ScreenCommon
      return
    }
  })
}

onMounted(() => {
  getCheckPersonInfo(id)
})
</script>

<template>
  <div>
    <div class="result-body">
      <div class="result-title">
        <h3>筛查结果</h3>
      </div>

      <div class="screen-result">
        <!--      如果还没有开始筛查-->
        <!--        <screen-common />-->
        <!--        <screen-error/>-->
        <!--        <screen-havedone />-->
        <component :is="component" :checkId="id" />
      </div>
      <!--       波浪效果-->
      <div class="wave-box">
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
        <div class="waves"></div>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
@import '../../variables';

.result-body {
  width: 85%;
  background-color: $bg-result;
  border-radius: 5px;
  margin: 20px auto;

  & .wave-box {
    position: relative;
    overflow: hidden;
    display: flex;
    // 波浪 效果
    & .waves {
      margin-left: 5.5px;
      width: 16px;
      height: 7.8px;
      border-radius: 16px 16px 0 0;
      background-color: $--bg-common;
    }
  }
}

.result-title {
  width: 100%;
  height: 3rem;
  border-bottom: #0fcfae 2px dashed;

  & h3 {
    line-height: 3rem;
    font-size: 1.5rem;
    color: #0fcfae;
    text-align: center;
  }
}

.result-items {
  margin: 0 auto;
}

.screen-result {
}
</style>
